<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class TRealdeviceState extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('t_realdevice_state', function (Blueprint $table) {
             $table->engine = 'MEMORY';
             $table->charset = 'utf8';
             $table->collation = 'utf8_general_ci';
            // CONTENT
            $table->increments('pdi_index')->nullable(false)->comment('');
			$table->integer('pdi_devid')->nullable(false)->default(0)->comment('');
			$table->string('pdi_name', 64)->nullable(false)->default('')->comment('');
			$table->integer('pdi_type')->nullable(false)->default(0)->comment('');
			$table->string('pdi_typename', 64)->nullable(false)->default('')->comment('');
			$table->string('pdi_typememo', 255)->nullable()->default(null)->comment('');
			$table->integer('pdi_warnlevel')->nullable(false)->default(0)->comment('');
			$table->string('pdi_warnname', 64)->nullable(false)->default('')->comment('');
			$table->integer('pdi_warnId')->nullable(false)->default(0)->comment('');
			$table->bigInteger('pdi_warnPId')->nullable(false)->default(0)->comment('');
			$table->integer('pdi_warnDId')->nullable(false)->default(0)->comment('');
			$table->integer('pdi_warnorigDId')->nullable()->default(0)->comment('');
			$table->integer('pdi_warnJId')->nullable(false)->default(0)->comment('');
			$table->integer('pdi_areaid')->nullable(false)->default(0)->comment('');
			$table->string('pdi_areaname', 60)->nullable(false)->default('')->comment('');
			$table->string('pdi_realtable', 64)->nullable(false)->default('')->comment('');
			$table->string('pdi_histable', 64)->nullable(false)->default('')->comment('');
			$table->datetime('pdi_updatetime')->nullable(false)->comment('');
			$table->unique('pdi_index', 'pdi_index');
			
        });

        
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('t_realdevice_state');
    }
}
